#ifndef ACTIVITY_H
#define ACTIVITY_H

#include <QObject>
#include <QTimer>
#include "participant.h"

namespace Data {
    class Activity;
}

class Activity : public QObject
{
    Q_OBJECT
public:
    enum ActivityStatus {
        RegistrationTimeout,
        ParticipantUpdated,
        ParticipantAdded,
        ParticipantUnknown,
        ParticipantManuallyCheckedIn,
        ParticipantNotFound,
        ActivityFound,
        IllegalApprover,
        OrganiserScanned,
        NetworkError
    };

    explicit Activity(QObject *parent = 0);
    Activity(QObject *parent, Participant *ActivityOrganiser, QByteArray activityUid, QString activityName, QDateTime activityStartTime, QDateTime activityStopTime, int registrationTimeout, bool loaded);
    QString getName(void);
    QDateTime getStartTime(void);
    QDateTime getStopTime(void);
    QByteArray getUid(void);
    int getRegTimeout(void);
    Participant* getOrganiser(void);
    void setActivityLoaded();
    bool isLoaded();

signals:
    void update(Activity::ActivityStatus status);
    void timeoutProgress(int incTime);

public slots:
    void dataUpdated(Participant *ActivityOrganiser, QByteArray activityUid, QString activityName, QDateTime activityStartTime, QDateTime activityStopTime, int activityRegTimeout);
    void participantUpdated(Participant *p);
    void participantAdd(Participant *p);
    void registrationTimeout();
    void organiserSignal(Participant *p, QByteArray approvedId);
    void activityUpdated(Activity::ActivityStatus status);

private slots:

public:
    QList<Participant*> participantList;
    Participant *organiser;

private:
    QString name;
    QByteArray uid;
    QDateTime startTime;
    QDateTime stopTime;
    QTimer *timer;
    int regTimeout;
    int currentTime;
    int deltaTime;
    bool activityLoaded;
    bool regTerminated;
};

#endif // ACTIVITY_H
